using System;
using System.Runtime.InteropServices;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Styling;

namespace AvaloniaWeChatList.Controls;

public class ChatWindow : Window
{
    public ChatWindow() : base()
    {
        Application.Current.ActualThemeVariantChanged += OnActualThemeVariantChanged;
    }

    private void OnActualThemeVariantChanged(object? sender, EventArgs e)
    {
        if (sender is not App app)
            return;

       
    }

    protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
    {
        base.OnPropertyChanged(change);

        if (change.Property == ActualThemeVariantProperty)
        {
            PseudoClasses.Set(Dark, Application.Current.RequestedThemeVariant == ThemeVariant.Dark);
        }
        else
        {
            PseudoClasses.Set(Dark, false);
        }
       
    }

    private const string Dark = ":dark";
}